import type { ElementHiderRuleConfig } from '../../../types/constants'
import { PageHandler } from '../../../lib/page_handler'
import { SogouPageType } from '../../../lib/page_handler/platform/sogou/types'
import { AppStyleCollections, ElementSelectorPosition, ElementSelectorType } from '../../../types/constants'
import { ELEMENT_IDENTIFIER_CONFIG } from '../../service/element_identifier/types'
import { addPrefixToConfig } from '../element_config'

/**
 * 搜索主页
 */
export const SO_GOU_INDEX_SEARCH_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrap .header .top-nav',
    position: ElementSelectorPosition.TopLeft,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexSearch,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrap .header .user-box',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexSearch,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.ai.aiEntry.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrap #content #deepseek-entry',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexSearch,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrap #QRcode-footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexSearch,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 微信主页
 */
export const SO_GOU_INDEX_WEIXIN_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header .top-nav',
    position: ElementSelectorPosition.TopLeft,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexWeixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header .user-box',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexWeixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper #footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexWeixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 知识主页
 */
export const SO_GOU_INDEX_KNOWLEDGE_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header .top-nav',
    position: ElementSelectorPosition.TopLeft,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexKnowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header #cniil_wza',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexKnowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper #footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexKnowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

export const SO_GOU_INDEX_ENCYCLOPEDIA_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header .top-nav',
    position: ElementSelectorPosition.TopLeft,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexEncyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .header #cniil_wza',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexEncyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.wrapper .ft',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.IndexEncyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 网页
 */
export const SO_GOU_WEB_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id .header .header-box .searchnav',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.unsupportedSearchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Multiple,
    selector: '#sogou_wrap_id .header .header-box .searchnav li:has(#sogou_pic, #sogou_hanyu, #sogou_fanyi)',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchInfo.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #wrapper #main .search-info',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTag.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #wrapper #main #stable_uphint',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTagFloat.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id .header .header-box #float_uphint',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.header .header-box .top-bar',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.ad.contentAd.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #wrapper #main .sponsored-ams',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.ai.aiAnswer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: `#sogou_wrap_id #wrapper #main :is(.reactResult.${AppStyleCollections.Search.class.SEARCH_AI_ANSWER})`,
    nameZh: '结果项-AI 回答',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.souGouBaike.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: `#sogou_wrap_id #wrapper #main :is(.vrwrap.${AppStyleCollections.Sogou.SOGOU_ENCYCLOPEDIA},.vrwrap:has(a[href*='baike.sogou.com'], a:contains('搜狗百科')))`,
    nameZh: '结果项-搜狗百科',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.souGouChinese.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: `#sogou_wrap_id #wrapper #main .results :is(.reactResult.${AppStyleCollections.Sogou.SOGOU_CHINESE}, .reactResult:has(h3:contains('搜狗汉语')))`,
    nameZh: '结果项-搜狗汉语',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.featuredContent.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: `#sogou_wrap_id #wrapper #main .results :is(.reactResult.${AppStyleCollections.Sogou.FEATURED_VIDEOS}, .reactResult:has(a:contains('精选视频')):has([class^=video-list]))`,
    nameZh: '结果项-精选视频',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.shortVideo.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: `#sogou_wrap_id #wrapper #main .results :is(.reactResult.${AppStyleCollections.Sogou.SHORT_VIDEO_HOT_LIST}, .reactResult:has(span:contains('短剧热搜榜')))`,
    nameZh: '结果项-短剧热搜榜',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.everyoneSearching.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#sogou_wrap_id #wrapper #main .results > .middle-better-hintBox',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Encyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.relatedSearches.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#sogou_wrap_id > .better-hintBox',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Encyclopedia,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchPagination.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #pagebar_container',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.rightAside.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #right',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.alsoAsk.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #right .reactResult',
    nameZh: '右侧边栏-还在问',
    nameEn: 'rightAsideReactResult',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Medical,
        SogouPageType.News,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.ad.adBar.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #right #ad_result_right',
    nameZh: '右侧边栏-广告',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.hotList.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#sogou_wrap_id #right div[class^=rank]:has(> .hot-title)',
    nameZh: '右侧边栏-热搜榜',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.hotNews.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #right #news_words',
    nameZh: '右侧边栏-新闻热点',
    position: ElementSelectorPosition.MiddleRight,
    enable: () => {
      const supportPages = [
        SogouPageType.News,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#sogou_wrap_id #s_footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Web,
        SogouPageType.Zhihu,
        SogouPageType.Medical,
        SogouPageType.Ask,
        SogouPageType.Encyclopedia,
        SogouPageType.News,
        SogouPageType.Knowledge,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 微信
 */
export const SO_GOU_WEIXIN_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.header-box .header .searchnav',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
        SogouPageType.WeixinNotFound,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.unsupportedSearchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Multiple,
    selector: '.header-box .header .searchnav li:has(#sogou_tupian, #sogou_hanyu, #sogou_fanyi, #sogou_yingwen, #sogou_xueshu)',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
        SogouPageType.WeixinNotFound,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.userCenter.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.header-box .login-info',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.tipMessage.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrapper #main .wx-topbox',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchPagination.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrapper #main #pagebar_container',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.bottomSearchBox.id]: {
    hide: false,
    selectorType: ElementSelectorType.Class,
    selector: '.bottom-form',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Id,
    selector: '#s_footer',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Weixin,
        SogouPageType.WeixinNotFound,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 视频
 */
export const SO_GOU_VIDEO_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.search.searchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#header .header-nav',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Video,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.unsupportedSearchTab.id]: {
    hide: false,
    selectorType: ElementSelectorType.Multiple,
    selector: '#header .header-nav li:has([data-type=pic], [data-type=hanyu], [data-type=keyword])',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Video,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.accessibility.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrap #header .access-result',
    position: ElementSelectorPosition.TopRight,
    enable: () => {
      const supportPages = [
        SogouPageType.Video,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.search.searchPagination.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#container .play_list_pg',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Video,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Complex,
    selector: '#wrap > .footer-result',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.Video,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 更多
 */
export const SO_GOU_MORE_PAGE_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.default.searchBox.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrapper #header',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.newArrivals.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#wrapper .new-pro',
    nameZh: '新品推荐',
    position: ElementSelectorPosition.TopCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.service.searchProducts.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: '#wrapper .pro-list h2:contains(搜索产品), #wrapper .pro-list h2:contains(搜索产品) ~ .productlist:not(#wrapper .pro-list h2:contains(桌面工具) ~ .productlist)',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.service.desktopTools.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: '#wrapper .pro-list h2:contains(桌面工具), #wrapper .pro-list h2:contains(桌面工具) ~ .productlist:not(#wrapper .pro-list h2:contains(手机软件) ~ .productlist)',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.service.mobileSoftware.id]: {
    hide: false,
    selectorType: ElementSelectorType.JQuery,
    selector: '#wrapper .pro-list h2:contains(手机软件), #wrapper .pro-list h2:contains(手机软件) ~ .productlist',
    position: ElementSelectorPosition.MiddleCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.footer.id]: {
    hide: false,
    selectorType: ElementSelectorType.Class,
    selector: '.cr',
    position: ElementSelectorPosition.BottomCenter,
    enable: () => {
      const supportPages = [
        SogouPageType.More,
      ]
      return supportPages.includes(PageHandler.getCurrentPageType() as SogouPageType)
    },
  },
}

/**
 * 所有配置
 */
export const SO_GOU_WEB_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  ...addPrefixToConfig(SO_GOU_INDEX_SEARCH_PAGE_ELEMENT_CONFIG, 'indexSearch'),
  ...addPrefixToConfig(SO_GOU_INDEX_WEIXIN_PAGE_ELEMENT_CONFIG, 'indexWeixin'),
  ...addPrefixToConfig(SO_GOU_INDEX_KNOWLEDGE_PAGE_ELEMENT_CONFIG, 'indexKnowledge'),
  ...addPrefixToConfig(SO_GOU_INDEX_ENCYCLOPEDIA_PAGE_ELEMENT_CONFIG, 'indexEncyclopedia'),
  ...addPrefixToConfig(SO_GOU_WEB_PAGE_ELEMENT_CONFIG, 'web'),
  ...addPrefixToConfig(SO_GOU_WEIXIN_PAGE_ELEMENT_CONFIG, 'weixin'),
  ...addPrefixToConfig(SO_GOU_VIDEO_PAGE_ELEMENT_CONFIG, 'video'),
  ...addPrefixToConfig(SO_GOU_MORE_PAGE_ELEMENT_CONFIG, 'more'),
}
